package cn.tank.interceptor;

import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author: ZLY
 * @Date: 2020/10/31 17:35
 * @Description:
 */
public class AuthorityInterceptor implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        String user = (String)request.getSession().getAttribute("user");
        if(user==null || user.trim().equals("")){
            response.sendRedirect("/sss/login");
            return false;
        }
        return true;
    }
}
